<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" data-rule="required" class="form-control" name="row[name]" type="text">
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lev')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-lev" style="width: 130px;" data-rule="required" class="form-control" name="row[lev]" type="number">
            <div style="font-size: 13px;color:#888;">*表示升级顺序，越小越靠前</div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lev1')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group" style="width: 130px;">
                <input id="c-lev1" data-rule="required" class="form-control" name="row[lev1]" type="number" value="">
                <span class="input-group-addon">%</span>
            </div>
            <div style="font-size: 13px;color:#888;">*除在产品填写的上级分佣之外的，额外返佣比例<br/>例如：某产品金额100元，上级返佣10%，上级额外返佣5%，则实际返佣15%，即15元</div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Lev2')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group" style="width: 130px;">
                <input id="c-lev2" data-rule="required" class="form-control" name="row[lev2]" type="number" value="0">
                <span class="input-group-addon">%</span>
            </div>
            <div style="font-size: 13px;color:#888;">*除在产品填写的上上级分佣之外的，额外返佣比例<br/>例如：某产品金额100元，上上级返佣5%，上上级额外返佣5%，则实际返佣10%，即10元</div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Task_type')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="radio">
            {foreach name="typeList" item="vo"}
            <label for="row[task_type]-{$key}"><input id="row[task_type]-{$key}" name="row[task_type]" type="radio" value="{$key}" {in name="key" value="1"}checked{/in} /> {$vo}</label> 
            {/foreach}
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Task')}:</label>
        <div class="col-xs-12 col-sm-10">
            <dl  class="fieldlist" data-name="row[task]" data-template="tpl_task">
                <dd class="form-inline header-box-title">
                    <ins style="width:240px">任务类型</ins>
                    <ins style="width:150px">达到数量</ins>
                </dd>
                <dd class="form-inline"><a href="javascript:;" id="btn_add_row_task" class="btn btn-sm btn-success btn-append"><i class="fa fa-plus"></i> 添加一行</a></dd>
            </dl>
            <textarea id="c-task" data-rule="required" class="form-control hide" rows="5" name="row[task]" cols="50">[{"name":"","num":""}]</textarea>
            <!--定义模板，模板语法使用Art-Template模板语法-->
            <script type="text/html" id="tpl_task">
                <dd class="form-inline">
                    <select class="form-control"  name="row[<%=name%>][<%=index%>][name]" style="width:240px">
                        <option value="">请选择</option>
                        <option value="推广人数" <%=row.name=="推广人数"?"selected":""%> >推广人数</option>
                        <option value="自身消费金额" <%=row.name=="自身消费金额"?"selected":""%> >自身消费金额</option>
                        <option value="下级消费金额" <%=row.name=="下级消费金额"?"selected":""%> >下级消费金额</option>
                    </select>
                    <input type="number"  style="width:150px" name="row[<%=name%>][<%=index%>][num]" class="form-control" value="<%=row['num']%>" size="10"/>
                    <span class="btn btn-sm btn-danger btn-remove"><i class="fa fa-trash-o"></i></span>
                </dd>
            </script>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Bg_image')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="input-group">
                <input id="c-bg_image" class="form-control" size="50" name="row[bg_image]" type="text" value="">
                <div class="input-group-addon no-border no-padding">
                    <span><button type="button"  data-params='{"category":"design"}' id="faupload-bg_image" class="btn btn-danger faupload" data-input-id="c-bg_image" data-mimetype="image/gif,image/jpeg,image/png,image/jpg,image/bmp,image/webp" data-multiple="false" data-preview-id="p-bg_image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                    <span><button type="button" id="fachoose-bg_image" class="btn btn-primary fachoose" data-input-id="c-bg_image" data-mimetype="image/*" data-multiple="false"><i class="fa fa-list"></i> {:__('Choose')}</button></span>
                </div>
                <span class="msg-box n-right" for="c-bg_image"></span>
            </div>
            <ul class="row list-inline faupload-preview" id="p-bg_image"></ul>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('Note')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-note"  class="form-control" name="row[note]" type="text">
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-primary btn-embossed disabled">{:__('OK')}</button>
        </div>
    </div>
</form>
<style>
    .input-group > .msg-box.n-right{
        left: 130px;
    }
    .fieldlist{
        width: 450px;
        background:#f9f9f9;
    }
    .fieldlist .form-inline.header-box-title ins{
        background-color: #f6f1ff !important;
        padding:5px;
    }
    .fieldlist .form-inline.header-box-title {
        background-color: #f6f1ff !important;
    }
    .fieldlist .form-inline {
        padding:0 5px;
    }
    .fieldlist .form-inline:nth-child(odd){
        background-color: #f6f1ff;
        padding:5px;
    }
</style>